package com.jy.appmarket.screenlock.activity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.ViewGroup.LayoutParams;

import com.jy.appmarket.R;
//import com.appssuper.toolbox.R;
import com.umeng.analytics.MobclickAgent;

/**
 * 类说明：
 * 
 * @author jie.li
 * @date 2015-4-10
 * @version 1.0
 */
public class XiaomiDialogActivity extends Activity {
	public static void startXiaomiDialogActivity(Context c, int promptType) {
		Intent intent = new Intent(c, XiaomiDialogActivity.class);
		// intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		Bundle b = new Bundle();
		b.putInt("miuiType", promptType);
		intent.putExtras(b);
		c.startActivity(intent);
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setTheme(R.style.home_page_dialog_theme);
		Intent intent = getIntent();
		Bundle b = intent.getExtras();
		int type = b.getInt("miuiType");
		if (type == 1) {
			setContentView(R.layout.setting_window_open_float_window_view);
		} else if (type == 2) {
			setContentView(R.layout.setting_window_auto_launch_view);
		} else if (type == 3) {
			setContentView(R.layout.setting_window_disable_sys_locker_miui_view);
		}
		getWindow().getAttributes().width = LayoutParams.MATCH_PARENT;
		getWindow().getAttributes().gravity = Gravity.TOP;
	}

	@Override
	public boolean onTouchEvent(MotionEvent event) {
		onBackPressed();
		return super.onTouchEvent(event);
	}

	@Override
	public void onBackPressed() {
		setResult(RESULT_OK);
		super.onBackPressed();
	}

	@Override
	protected void onResume() {
		super.onResume();
		MobclickAgent.onResume(this);
	}

	@Override
	protected void onPause() {
		super.onPause();
		MobclickAgent.onPause(this);
	}
}
